//
//  ExampleViewController.m
//  JimiPay
//
//  Created by yull on 16/1/10.
//  Copyright (c) 2016年 com.shengyun. All rights reserved.
//

#import "ExampleViewController.h"
#import "TDRealNameCertificationTableViewController.h"
#import "TDBindingCardTableViewController.h"
#import "InfoCertificationViewController.h"

@interface ExampleViewController ()

@end

@implementation ExampleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    [self setupCustomBackItem];
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    UIImage *image = nil;
    if (self.isBindCard) {
        self.navigationItem.title = @"绑定银行卡";
        
        image = [UIImage imageNamed:@"usercenter_bank_example.jpg"];
    } else {
        self.navigationItem.title = @"实名认证";
        
        image = self.isRealName ? [UIImage imageNamed:@"usercenter_idcard.jpg"] : [UIImage imageNamed:@"usercenter_example_all.jpg"];
    }
    
    self.exampleIV.image = image;
    CGFloat scale = image.size.width / ([UIScreen mainScreen].bounds.size.width - 16);
    self.exampleIV.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 16, image.size.height / scale);
    self.scollView.contentSize = CGSizeMake(1, self.exampleIV.frame.size.height);
    
}

- (IBAction)button_next:(id)sender {
    
    if (self.isBindCard) {
        
        TDBindingCardTableViewController *controller = [[TDBindingCardTableViewController alloc] initWithStyle:UITableViewStylePlain];
        controller.hidesBottomBarWhenPushed = YES;
        
        NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
        [vcs removeLastObject];
        [vcs addObject:controller];
        [self.navigationController setViewControllers:vcs animated:YES];
    } else if (self.isRealName) {
        
        TDRealNameCertificationTableViewController *controller = [[TDRealNameCertificationTableViewController alloc] initWithStyle:UITableViewStylePlain];
        controller.hidesBottomBarWhenPushed = YES;
        
        NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
        [vcs removeLastObject];
        [vcs addObject:controller];
        [self.navigationController setViewControllers:vcs animated:YES];
    } else {
        
        InfoCertificationViewController *controller = [[InfoCertificationViewController alloc] initWithStyle:UITableViewStylePlain];
        controller.hidesBottomBarWhenPushed = YES;
        
        NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
        [vcs removeLastObject];
        [vcs addObject:controller];
        [self.navigationController setViewControllers:vcs animated:YES];
    }
}

@end
